cmake_minimum_required(VERSION 2.8)
project(goatvfs)

aux_source_directory(src SRC)
include_directories(include)
file(GLOB PUBHDR include/*.h)
file(GLOB HDR src/*.h)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

add_library(goatvfs SHARED ${SRC} ${HDR} ${PUBHDR})
add_library(goatvfs_static STATIC ${SRC} ${HDR} ${PUBHDR})

set_target_properties(goatvfs PROPERTIES SOVERSION 0 VERSION 0.1)

if(NOT WINDOWS)
	# if not on windows set the static library name as "goatvfs" instead of "goatvfs_static"
	set_target_properties(goatvfs_static PROPERTIES OUTPUT_NAME goatvfs)
endif(NOT WINDOWS)

install(TARGETS goatvfs goatvfs_static
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib)
install(FILES ${PUBHDR} DESTINATION include)

# cpack stuff

# uncomment to enable debian package generation
set(CPACK_BINARY_DEB "ON")
set(CPACK_PACKAGE_CONTACT "John Tsiombikas <nuclear@members.fsf.org>")

set(CPACK_BINARY_STGZ "OFF")
set(CPACK_BINARY_TGZ "ON")
set(CPACK_BINARY_TZ "OFF")

set(CPACK_SOURCE_TGZ "ON")
set(CPACK_SOURCE_TBZ2 "OFF")
set(CPACK_SOURCE_TZ "OFF")

if(LINUX)
	set(CPACK_SYSTEM_NAME "gnulinux")
endif(LINUX)

set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
include(CPack)
